import {post,text} from '@/common/request';
import {requestParams, urlApiClientContent, urlPublicContent} from './ServerService';

const practiceUrl = urlApiClientContent + 'practice/';
const checkUrl = urlApiClientContent + 'check/';
const exerciseUrl = urlApiClientContent + 'exercise/';
const url=urlApiClientContent + 'partake/'
const practiceStudyUrl = urlApiClientContent + 'practiceStudy/';

// 查询在线练测的顶部tab
export function getBzPracticeTab({id}) {
    return post(practiceUrl +  requestParams('getBzPracticeTab', {id}), null);
}

//  查询练习
export function listPractice({id,practiceType}) {
    return post(practiceUrl +  requestParams('listPractice', {id,practiceType}), null);
}

//  开始练习
export function startPractice({practiceUuid, id,modelType,practiceType,planOutlineUuid,outlineSubjectUuid,structUuid,itemType}) {
    return post(practiceUrl +  requestParams('startPractice', {practiceUuid,id,modelType,practiceType,planOutlineUuid,outlineSubjectUuid,structUuid,itemType}), null);
}

//  查询试题导航
export function getItemNavigation({practiceUuid}) {
    return post(practiceUrl +  requestParams('getItemNavigation', {practiceUuid}), null);
}

// 获取试题 
export function getItem({practiceUuid,itemNo,itemType=""}) {
    return post(practiceUrl +  requestParams('getItem', {practiceUuid,itemNo,itemType}), null);
}
 
// 获取答案 
export function getAnswer({practiceUuid,itemUuid,stuAnswer}) {
    return text(practiceUrl +  requestParams('getAnswer', {practiceUuid,itemUuid}), stuAnswer);
}

// 收藏试题 
export function collectItem({practiceUuid,itemUuid}) {
    return post(practiceUrl +  requestParams('collectItem', {practiceUuid,itemUuid}), null);
}

// 取消收藏试题 
export function cancelCollectItem({practiceUuid,itemUuid}) {
    return post(practiceUrl +  requestParams('cancelCollectItem', {practiceUuid,itemUuid}), null);
}

// 取消错题收藏 
export function collectItems({exerciseId}) {
    return post(exerciseUrl +  requestParams('collectItem', {exerciseId}), null);
}

//  练习次数++
export function addPracticeNum({practiceUuid}) {
    return post(practiceUrl +  requestParams('addPracticeNum', {practiceUuid}), null);
}

// 查询模拟自测列表 
export function getPracticeSelfTestList({id}) {
    return post(checkUrl +  requestParams('getPracticeSelfTestList', {id}), null);
}

// 查询模拟评测详情信息
export function getBhCheck({outLineTestId,id}) {
    return post(checkUrl +  requestParams('getBhCheck', {outLineTestId,id}), null);
}

//  组卷
export function composePaper({outLineTestId,id}) {
    return post(checkUrl +  requestParams('composePaper', {outLineTestId,id}), null);
}

//  获取试卷
export function getPaper({bhCheckUuid,resourceId=""}) {
    return post(checkUrl +  requestParams('getPaper', {bhCheckUuid,resourceId}), null);
}

// 答题 
export function uploadStuAnswer({checkItemId,answer}) {
    return post(checkUrl +  requestParams('uploadStuAnswer', {checkItemId,answer}), null);
}

// 交卷 

export function submitPaper({checkUuid}) {
    return post(checkUrl +  requestParams('submitPaper', {checkUuid}), null);
}

// 标记 
export function setSign({checkItemId}) {
    return post(checkUrl +  requestParams('setSign', {checkItemId}), null);
}

// 查询历史练测 
export function listHisChecks({id,outLineTestId}) {
    return post(checkUrl +  requestParams('listHisChecks', {id,outLineTestId}), null);
}

// 获取学员tab 
export function studentTab() {
    return post(exerciseUrl +  requestParams('studentTab', {}), null);
}

//  在线练测错题/收藏列表计划项目
export function questionTabPractice({type,queryKey}) {
    return post(exerciseUrl +  requestParams('questionTabPractice', {type,queryKey}), null); 
}

//  题库市场错题/收藏列表计划项目
export function questionTabItemMarket({type,queryKey}) {
    return post(exerciseUrl +  requestParams('questionTabItemMarket', {type,queryKey}), null); 
}

// 在线练测错题/收藏-题型
export function questionTabPracticeItemType({type,practiceUuid,tabType="1"}) {
    return post(exerciseUrl +  requestParams('questionTabPracticeItemType', {type,practiceUuid,tabType}), null); 
}

// 在线练测错题/收藏-题型-头部 
export function questionTabPracticeItemTypeHeader({type,practiceUuid,tabType="1"}) {
    return post(exerciseUrl +  requestParams('questionTabPracticeItemTypeHeader', {type,practiceUuid,tabType}), null); 
}

//  查询试题导航
export function getItemNavigations({practiceUuid,type,itemType,tableName}) {
    return post(exerciseUrl +  requestParams('getItemNavigation', {practiceUuid,type,itemType,tableName}), null);
}

// 获取试题 
export function getItems({practiceUuid,type,itemNo,itemType,tableName}) {
    return post(exerciseUrl +  requestParams('getItem', {practiceUuid,type,itemNo,itemType,tableName}), null);
}

// 获取答案 
export function getAnswers({practiceUuid,type,itemUuid,stuAnswer}) {
    return text(exerciseUrl +  requestParams('getAnswer', {practiceUuid,type,itemUuid,}), stuAnswer);
}

// 清除练习
export function clearUpPractiseHistory({practiceUuid,type}) {
    return post(practiceUrl +  requestParams('clearUpPractiseHistory', {practiceUuid,type}), null);
}

// 收藏头部展示数据 
export function questionTabPracticeHeader({type}) {
    return post(exerciseUrl +  requestParams('questionTabPracticeHeader', {type}), null);
}

//我参与的
export function pagePracticePlan({tabType=""}) {
    return post(url +  requestParams('pagePracticePlan', {tabType}), null);
}


// 查看解析
export function getAnalysisList({checkId}) {
    return post(checkUrl +  requestParams('getAnalysisList', {checkId}), null);
}


// 收藏里取消收藏
export function cancelCollectItems({exerciseId,type}) {
    return post(exerciseUrl +  requestParams('cancelCollectItem', {exerciseId,type}), null);
}

// 获取在线学习统计 
export function getPracticeStudyCount({id,uuid}) {
    return post(practiceStudyUrl +  requestParams('getPracticeStudyCount', {id,uuid}), null);
}

// 查询学习课件 
export function queryStudyResourceList({id}) {
    return post(practiceStudyUrl +  requestParams('queryStudyResourceList', {id}), null);
}
export function queryStudyResourceAbout({id,uuid,currOutlineResourceUuid}) {
    return post(practiceStudyUrl +  requestParams('queryStudyResourceAbout', {id,uuid,currOutlineResourceUuid}), null);
}



// 获取视频 
export function getMediaUrl({id,outlineResourceUuid,recordUuid}) {
    return post(practiceStudyUrl +  requestParams('getMediaUrl', {id,outlineResourceUuid,recordUuid}), null);
}


// 获取视频的参与学习人数 
export function getResourceStudyNum({recordUuid}) {
    return post(practiceStudyUrl +  requestParams('getResourceStudyNum', {recordUuid}), null);
}


// 添加笔记 
export function saveNotes({recordUuid,notesContent,learningTime}) {
    return post(practiceStudyUrl +  requestParams('saveNotes', {recordUuid,notesContent,learningTime}), null);
}

// 查询笔记 
export function queryNotes({recordUuid}) {
    return post(practiceStudyUrl +  requestParams('queryNotes', {recordUuid}), null);
}

// 更新学习时长
export function updateVideoStudyTime({recordUuid,time,token}) {
    return post(practiceStudyUrl +  requestParams('updateVideoStudyTime', {recordUuid,time,token}), null);
}


// 开始练习
export function startPractices({recordUuid,resourceId=""}) {
    return post(practiceStudyUrl +  requestParams('startPractice', {recordUuid,resourceId}), null);
}

//  查询学习课件上一个下一个
export function queryStudyResourceNext({id,uuid,outlineResourceUuid,next}) {
    return post(practiceStudyUrl +  requestParams('queryStudyResourceNext', {id,uuid,outlineResourceUuid,next}), null);
}

// 获取试题
export function getItemVideo({practiceUuid,itemNo}) {
    return post(practiceStudyUrl +  requestParams('getItem', {practiceUuid,itemNo}), null);
}

// 获取答案 
export function getAnswerVideo({practiceUuid,itemUuid,stuAnswer}) {
    return text(practiceStudyUrl +  requestParams('getAnswer', {practiceUuid,itemUuid}), stuAnswer);
}

// 收藏试题
export function collectItemVideo({practiceUuid,itemUuid}) {
    return post(practiceStudyUrl +  requestParams('collectItem', {practiceUuid,itemUuid}), null);
}

// 取消收藏试题
export function cancelCollectItemVideo({practiceUuid,itemUuid}) {
    return post(practiceStudyUrl +  requestParams('cancelCollectItem', {practiceUuid,itemUuid}), null);
}

// 查询教材资源和资料文档参与试题 type=1  type=2资料文档 type=1教材资源
export function resListPage({type,name}) {
    return post(url +  requestParams('resList', {type,name}), null);
}

// 记录教材资源和资料文档 type=1  type=2资料文档 type=1教材资源
export function resVisit({type,resourceId}) {
    return post(url +  requestParams('resVisit', {type,resourceId}), null);
}
